#define _CRT_SECURE_NO_WARNINGS  1
#include <stdio.h>
#include<stdlib.h>
int arr[2000000];
int cmp(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &arr[i]);
    qsort(arr, n, sizeof(int), cmp);
    int count=0,flag=0;
    for (int i = 0; i< n; i++)
    {
        if (i == 0)
            flag = arr[i];
        if (arr[i] == flag)
            count++;
        else
        {
            if (count % 2 == 1)
                break;
            count = 1;
            flag = arr[i];
        }
    }
    printf("%d", flag);
    return 0;
}